/* eslint-disable */
// import {
//     GeometryAttribute, Geometry, ComponentDatatype, GeometryAttributes
// } from 'cesium'
let { GeometryAttribute } = Cesium
let { Geometry } = Cesium
let { ComponentDatatype } = Cesium
let { GeometryAttributes } = Cesium

export function getGeometry(positionAry, clOrStAry, indicesAry, isTex) {
    const geometryAttributes = {
        position: new GeometryAttribute({
            componentDatatype: ComponentDatatype.FLOAT,
            componentsPerAttribute: 3,
            values: new Float32Array(positionAry)
        })
    }

    const geometryAttribute = {
        componentDatatype: ComponentDatatype.FLOAT,
        componentsPerAttribute: 2,
        values: new Float32Array(clOrStAry)
    }
    if (isTex) {
        geometryAttributes.st = new GeometryAttribute(geometryAttribute)
    } else {
        geometryAttribute.componentsPerAttribute = 4
        geometryAttributes.color = new GeometryAttribute(geometryAttribute)
    }

    return new Geometry({
        attributes: new GeometryAttributes(geometryAttributes),
        indices: new Uint32Array(indicesAry)
    })
}
